package cn.scy.business.controller.guangzlt;

import cn.scy.annotation.PassToken;
import cn.scy.base.PageResult;
import cn.scy.base.ResponseDTO;
import cn.scy.business.domain.entity.guangzlt.NumNumberInfo;
import cn.scy.business.domain.entity.guangzlt.NumReportInfo;
import cn.scy.business.domain.param.guangzlt.NotifyCustomerReq;
import cn.scy.business.domain.param.guangzlt.NumNumberInfoBatchParam;
import cn.scy.business.domain.param.guangzlt.NumNumberInfoParam;
import cn.scy.business.service.guangzlt.NumNumberInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 广州联通
 * 报备管理-号码表 前端控制器
 *
 * @author scy
 * @since 2025-04-27
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/num/number")
public class NumNumberInfoController {

    private final NumNumberInfoService numberInfoService;

    @GetMapping("listPage")
    public ResponseDTO<PageResult<NumNumberInfo>> listPage(NumNumberInfoParam param) {
        return ResponseDTO.ok(numberInfoService.listPage(param));
    }

    @GetMapping("info")
    public ResponseDTO<NumNumberInfo> info(@RequestParam("id") String id) {
        return ResponseDTO.ok(numberInfoService.info(id));
    }

    @PostMapping("add")
    public ResponseDTO<Boolean> addNumber(@RequestBody NumNumberInfo numNumberInfo) {
        return ResponseDTO.ok(numberInfoService.addNumber(numNumberInfo));
    }

    @PostMapping("addBatch")
    public ResponseDTO<Boolean> addNumberBatch(@RequestBody NumNumberInfoBatchParam param) {
        return ResponseDTO.ok(numberInfoService.addNumberBatch(param));
    }

    @PostMapping("edit")
    public ResponseDTO<Boolean> editNumber(@RequestBody NumNumberInfo numNumberInfo) {
        return ResponseDTO.ok(numberInfoService.editNumber(numNumberInfo));
    }

    @PostMapping("delete")
    public ResponseDTO<Boolean> deleteNumber(@RequestParam("id") String id) {
        return ResponseDTO.ok(numberInfoService.deleteNumber(id));
    }

    @PostMapping("report")
    public ResponseDTO<Boolean> report(@RequestBody NumReportInfo numReportInfo) {
        return ResponseDTO.ok(numberInfoService.report(numReportInfo));
    }

    @PassToken
    @PostMapping("customerTelA/notify")
    public Map<String, Object> notifyReq(@RequestBody NotifyCustomerReq req) {
        return numberInfoService.notifyReq(req);
    }

}
